package com.qys.livesMall.product.controller.app;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qys.livesMall.common.result.R;
import com.qys.livesMall.product.entity.H2ProductGoodsinfo;
import com.qys.livesMall.product.entity.H2ProductProduct;
import com.qys.livesMall.product.entity.query.RequestData;
import com.qys.livesMall.product.model.H2ProductGoodsinfoDto;
import com.qys.livesMall.product.service.H2ProductGoodsinfoService;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 *  商品模块
 * @author gmx
 * @since 2023-05-17
 */
@RestController
@RequestMapping("/app/h2-shop-goodsinfo")
@Validated
public class AppH2ProductGoodsinfoController {
    @Resource
    private H2ProductGoodsinfoService spuService;

    /***
     * 根据商品id查询
     */
    @GetMapping("/prdouct/{goodId}")

    public R<H2ProductProduct> product(@PathVariable Long goodId){
        return spuService.appProduct(goodId);
    }

    /***
     * 商品分页查询
     */
    @PostMapping("/page")
    public R<IPage<H2ProductGoodsinfoDto>> pageList(@RequestBody RequestData<H2ProductGoodsinfo> data){
        R<IPage<H2ProductGoodsinfoDto>> res = spuService.appListPageByCatid(data);
        return res;
    }

}
